<!-- 项目管理 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">商品列表</p>
    <!-- sonRouter="yybureauFormationBJ" 为跳转新的页面编辑 -->
    <dxtable
      :dataJson="dataJson"
      :portUrl="portUrl"
      :formJson="formJson"
      :qx="qx"
      ref="databale"
    ></dxtable>
  </div>
</template>
<script lang="ts" setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost } from "../../util/index";
import { NButton, NImage, NTag } from "naive-ui";
import { h, ref, reactive } from "vue";
const databale = ref();
const initeer = () => {
  databale.value.initDataExpose();
};
let dataJson = [
  {
    title: "商品名称",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "name",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品内部名称",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "internal_name",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品分类",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "category_id",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品归属",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "commodity_ownership",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "链接广告域名",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "domain_name",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "进货价格",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "cost_price",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "单个卖价",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "selling_price",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "采购链接",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "purchasing_links",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品描述",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 24,
    key: "description",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "主图",
    type: "img",
    val: "",
    icon: "dx-img",
    span: 12,
    key: "main_image",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "其他图片",
    type: "img",
    val: "",
    icon: "dx-img",
    span: 24,
    key: "images",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品状态",
    type: "radio",
    icon: "dx-radiobox",
    val: "",
    opt: [
      {
        label: "下架",
        value: 1,
      },
      {
        label: "上架",
        value: "0",
      },
    ],
  },
];

const qx = {
  DeletePermissionID: "xhkjsplistdel", //删除
  EditPermissionIdentifier: "xhkjsplistbj", // 编辑
  NewPermissionIdentifier: "xhkjsplistxz", // 新建
  ViewPermissionID: "xhkjsplistck", // 查看
};
const portUrl = "kjds/sys_products/sys_products";

let formJson = reactive([
  {
    title: "商品名称",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "name",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品内部名称",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "internal_name",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品分类",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "category_id",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品归属",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "commodity_ownership",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "链接广告域名",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "domain_name",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "进货价格",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "cost_price",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "单个卖价",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "selling_price",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "采购链接",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "purchasing_links",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品描述",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 24,
    key: "description",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "主图",
    type: "img",
    val: "",
    icon: "dx-img",
    span: 12,
    key: "main_image",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "其他图片",
    type: "img",
    val: "",
    icon: "dx-img",
    span: 24,
    key: "images",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "商品状态",
    type: "radio",
    icon: "dx-radiobox",
    val: "",
    opt: [
      {
        label: "下架",
        value: 1,
      },
      {
        label: "上架",
        value: "0",
      },
    ],
    span: 12,
    key: "status",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
]);
const czFun = {
  fun: (row) => {
    return [
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {},
        },
        "复制代码"
      ),
    ];
  },
};

// 获取字典内容
// const xtgxxmfl = async () => {
//   const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'xtgxxmfl' })
//   dataJson[2].options = [
//     {
//       label: "全部",
//       value: ""
//     },
//     ...data
//   ]
//   formJson[2].options = data
//   xmlxSelect.value = data
//   console.log(data);
// }
// xtgxxmfl()
</script>
<style scoped></style>
